<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
	<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/styles.css" />
	<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/jquery-ui-1.8.16.custom.css" />

	<script src="<?php echo base_url(); ?>assets/js/jquery-1.7.1.min.js" type="text/javascript"></script>
	<script src="<?php echo base_url(); ?>assets/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>

	<script src="<?php echo base_url(); ?>assets/js/jquery-css-transform.js" type="text/javascript"></script>
	<script src="<?php echo base_url(); ?>assets/js/sun-rays.js" type="text/javascript"></script>
	<script src="<?php echo base_url(); ?>assets/js/jquery-animate-css-rotate-scale.js" type="text/javascript"></script>
	<script src="<?php echo base_url(); ?>assets/js/jheader-area.js" type="text/javascript"></script>
	<script src="<?php echo base_url(); ?>assets/js/edit_profile.js" type="text/javascript"></script>


    <title><?php echo $title; ?></title>
	<script language="JavaScript" type="text/javascript">

		$(document).ready(function(){
			
			$('#loader img').hide(); $('#edit-pic').hide(); $('#edit-thumbs').hide();
			$('#edit_name img').hide(); $('#edit_me img').hide(); $('#edit_cancel img').hide();
			$('#edit_cancel1 img').hide(); $('#save_name img').hide(); $('#save_me img').hide();

			$('#thumbs').live('mouseenter',function(){
					$('#edit-pic').show();
			});
			$('#thumbs').mouseleave(function(){
				$('#edit-pic').hide();
			});
			$('#edit-pic').click(function(){
				$('#edit-thumbs').show();
			});

			$('#pic_cancel').click(function(){
				$('#edit-thumbs').hide();
			});

			$('#submitpic').click(function(){
				var picname  = $('#userpic').attr("value");
				if(picname == ''){
						$('#edit-message').css({
							backgroundColor: '#FCFCC4',
							paddingLeft : '5px',
							color : 'red'
						}).html('Please select a file').fadeIn(1000).delay(1000).fadeOut(1000);
				}
				else{
				$('#edit-profile-form').attr('action','<?php echo base_url();?>profile/update_picture');
				$('#edit-profile-form').submit();
				}
			});

			$('#name-h2').live('mouseenter',function(){
				if(!$('#edit_cancel img').is(':visible')){
					$('#edit_name img').show();
				}
			});
			$('#name-h2').mouseleave(function(){
				$('#edit_name img').hide();
			});
			$('#edit_name img').click(function(){
				$('#edit_name img').hide();
				$('#edit_cancel img').show();
				$('#save_name img').show();
				var f_name = $.trim($('#n-fname').html());
				var l_name = $.trim($('#n-lname').html());
				$('#org_val_fname').html(f_name);
				$('#org_val_lname').html(l_name);
				$('#n-fname').html('<input type="text" size = "10" name = "n-fname" id = "n-fname-id" value = "'+f_name+'">');
				$('#n-lname').html('<input type="text" size = "10" name = "n-lname" id = "n-lname-id" value = "'+l_name+'">');
			});
			$('#edit_cancel').click(function(){
				$('#edit_cancel img').hide();
				$('#edit_name img').show();
				$('#save_name img').hide();
				$('#n-fname').html($('#org_val_fname').html());
				$('#n-lname').html($('#org_val_lname').html());
			});
			$('#about-h2-wrap').live('mouseenter',function(){
				if(!$('#edit_cancel1 img').is(':visible')){
				$('#edit_me img').show();
				}
			});
			$('#about-h2-wrap').mouseleave(function(){
				$('#edit_me img').hide();
			});
			$('#edit_me img').click(function(){
				$(this).hide();
				$('#edit_cancel1 img').show();
				$('#save_me img').show();
				var about_me = $.trim($('#about_me').html());
				$('#org_me').val(about_me);
				$('#about_me').html('<textarea name="name" rows="20" id = "me" cols="27" wrap="on">'+about_me+'</textarea>');
			});
			$('#edit_cancel1 img').click(function(){
				$(this).hide();
				$('#edit_me img').show();
				$('#save_me img').hide()
				$('#about_me').html($('#org_me').val());
			});
			$('#save_name img').click(function(){
				var path = $('#hidden').attr("value");
				var fname = $('#n-fname-id').val();
				var lname = $('#n-lname-id').val();
				$.ajax({
					url: path,
					data: 'firstname='+fname+'&lastname='+lname,
					type : 'POST',
					beforeSend: function(){
						$('#loader img').show();
					},
					success:function(data){
						$('#loader img').fadeOut(2000, function(){
							$('#edit-message').css(
							{backgroundColor: '#FCFCC4', paddingLeft : '5px', color : 'red'}
							).html('Edit profile is successfully save').fadeIn(500).delay(500).fadeOut(1000, function(){
								$('#edit_cancel img').hide(); $('#save_name img').hide();
								var fname = $('#n-fname-id').val();
								var lname = $('#n-lname-id').val();;
								$('#n-fname').html(fname);
								$('#n-lname').html(lname);
							});
						});
					},
					complete: function(){

					}
				});
			});

			$('#save_me img').click(function(){
				var path = $('#hidden').attr("value");
				var me = $('#me').val();
				$.ajax({
					url: path,
					data: 'about='+me,
					type : 'POST',
					beforeSend: function(){
						$('#loader img').show();
					},
					success:function(data){
						$('#loader img').fadeOut(2000, function(){
							$('#edit-message').css(
							{backgroundColor: '#FCFCC4', paddingLeft : '5px', color : 'red'}
							).html('Edit of your About Me is successfully save').fadeIn(500).delay(500).fadeOut(1000, function(){
								$('#edit_cancel1 img').hide(); $('#save_me img').hide();
								var about_me = $('#me').val();
								//$('#org_me').val(about_me);
								$('#about_me').html(about_me);
								//alert(about_me);
							});
						});
					},
					complete: function(){
					}
				});
			});
			
			//load password setup view
			$("#password_setup").click(function(){
				$.ajax({
					url: '<?php echo base_url();?>password_setup',
					success:function(response){
						$("#message-listing").html(response);
					}//end success
				
				});//end ajax
				return false;
			});
			
			//end password setup
	
			

		});//end document ready

	</script>


</head>
<?php
$records = myuser_helper::getUserData();
?>
<body>
<div id = "bg-container">
	<div id = "sun-rays" class = "sun-rays">
	</div>
</div>
<div class = "clear">
<div id = "wrapper"><!-- start of wrapper-->
	<header>
		<div id = "flash-area">
			<embed src="<?php echo base_url(); ?>assets/images/hearttree-profile.swf" width="212" height="180" type="application/x-shockwave-flash" wmode="transparent" menu="false" />
		</div>
		<div id = "menu-area">
			<ul id = "user-menu">
				<a href = "<?php echo base_url()?>profile" title = "Home"><li class = "user-home"></li></a>
				<a href = "<?php echo base_url()?>profile" title = "Profile"><li class = "user-profile"></li></a>
				<a href = "<?php echo base_url()?>testimonial" title = "Testimonial"><li class = "user-testi"></li></a>
				<a href = ""><li class = "user-faq"></li></a>
				<a href = "<?php echo base_url()?>contact" title = "Contact Us"><li class = "user-contct"></li></a>
			</ul>
		</div>
		
		<div id = "account-area">
			<div id = "account-wrap">
				<div id = "accountz">
					<div class = "profile-pic"><img style="width:30px;height:27px;" src = "<?php echo !empty($records->picture) ? base_url().'assets/images'.$records->picture : base_url().'assets/images/default.png';?>" /></div>
					<?php /*$email = $this->session->userdata('email');
					 $userid = Myuser_helper::get_userid($email); */?>

					<h2><?php echo $records->firstname; ?></h2>

					<span id = "arrow-down"><img src = "<?php echo base_url(); ?>assets/images/arrow-down.png" /></a></span>
					<div id = "account-list">
						<ul>
							<li><a href = "">My Account</a></li>
							<li><a href = "">Edit Settings</a></li>
							<li><a href = "">Help</a></li>
							<li><a href = "<?php echo base_url() ?>/profile/logout">Logout</a></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</header>
	<div id = "wrap">
		<div id = "side-left">
			<div id = "profile-area">
				<form id = "edit-profile-form" name = "edit-profile-form" action = "" method = "POST" enctype="multipart/form-data">
					<div id = "thumbs">
					
						<div id = "edit-pic">Change Picture</div>
						<img style="width:185px;height:185px;" src = "<?php echo !empty($records->picture) ? base_url().'assets/images'.$records->picture :	'assets/images/default.png'; ?>" />
						<input type = "hidden" id = "hidden1" value = "<?php echo base_url();?>profile/update_picture" />
					</div>
					<div id = "edit-thumbs">
						<input type="file" name="userpic" id="userpic" size="15" />
						<span id = "pic_cancel" style = "float:left;margin-top:2px;" title = "Cancel"><img src = "<?php echo base_url()?>assets/images/cancelbutton.png" alt = "cancel"/></span>
						<input type="image" name="submitpic" id="submitpic" src = "<?php echo base_url()?>assets/images/savebutton.png" />
					</div>
					<input id = "hidden" type = "hidden" value = "<?php echo base_url();?>profile/update_profile"/>
					<p id = "loader"><img src = "<?php echo base_url()?>/assets/images/ajax-loader.gif" /></p>
					<p id = "edit-message"></p>
					<p><div id = "name-h2"><div id = "n-fname"><?php echo $records->firstname; ?></div>&nbsp;<div id = "n-lname"><?php echo $records->lastname; ?></div><span id = "edit_name" style = "float:left;margin-top:0px; margin-left:2px"><img src = "<?php echo base_url()?>assets/images/editbutton.png" /></span><span id = "edit_cancel" style = "float:left;margin-top:0px; margin-left:2px"><img src = "<?php echo base_url()?>assets/images/cancelbutton.png" /></span><span id = "save_name"><img src = "<?php echo base_url()?>assets/images/savebutton.png" /></span></div></p>
					<p><div id = "about-h2-wrap"><h2 id = "about-h2">About Me</h2><span id = "edit_me" style = "float:left; margin-left:2px"><img src = "<?php echo base_url()?>assets/images/editbutton.png" /></span><span id = "edit_cancel1" style = "float:left;margin-top:0px; margin-left:2px"><img src = "<?php echo base_url()?>assets/images/cancelbutton.png" /></span><span id = "save_me"><img src = "<?php echo base_url()?>assets/images/savebutton.png" /></span></div></p>
					<p id = "about_me"><?php echo $records->about; ?></p>
					<div id="org_val_fname" style="display:none;"></div>
					<div id="org_val_lname" style="display:none;"></div>
					<input type = "hidden" id = "org_me" />
				</form>
			</div>
		</div>
		<div id = "side-right">